using System;
using System.Collections.Generic;
using System.Text;

namespace Krile.Kernel.Data
{
    //master means krile user.
    public abstract class User
    {
        /// <summary>
        /// Parent service's identification string
        /// </summary>
        public abstract string ParentServiceId { get; }

        /// <summary>
        /// Lookup parent svc.
        /// </summary>
        public Service ParentService
        {
            get
            {
                Krile.Kernel.Data.Service ret = null;
                if ((ret = Bridge.PluginManager.LookupService(ParentServiceId)) == null)
                    throw new NullReferenceException("Lookup Failed:" + ParentServiceId);
                return ret;
            }
        }

        /// <summary>
        /// Lookup parent agent
        /// </summary>
        public Plugin.Operations.IAgent ParentAgent
        {
            get { return (Plugin.Operations.IAgent)ParentService.ParentPlugin.Operation; }
        }

        /// <summary>
        /// User name(screen name)
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// User id(login name)
        /// </summary>
        public virtual string Id { get; set; }

        /// <summary>
        /// User's icon image uri
        /// </summary>
        public virtual Uri IconUri { get; set; }

        /// <summary>
        /// User's profile page uri
        /// </summary>
        public virtual Uri ProfileUri { get; set; }

        /// <summary>
        /// When master following this user,this flagment's value set true.
        /// </summary>
        /// <remarks>
        /// Krile Base System do not mention this value.
        /// But, relying plugin might be mention it.
        /// I suggest you to set this flagment.
        /// </remarks>
        public virtual bool Following { get; set; }

        /// <summary>
        /// When this user be in protected mode, this flagment's value set true.
        /// </summary>
        /// <remarks>
        /// Krile Base System do not mention this value.
        /// But, relying plugin might be mention it.
        /// I suggest you to set this flagment.
        /// </remarks>
        public virtual bool Protected { get; set; }

        /// <summary>
        /// Extra data
        /// </summary>
        public virtual object ExObject { get; set; }

        /// <summary>
        /// Equals this.Name
        /// </summary>
        public override string ToString()
        {
            return this.Name;
        }
    }
}
